package org.top10.dealor;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

//允许--作为注释
public class FileDealor {
	
	private static final String COMMENT="--";
	public  static void readFile(String path,LineDealor dealor) {
		try {
			InputStream is = FileDealor.class.getClassLoader().getResourceAsStream(
					path);
			InputStreamReader ff = new InputStreamReader(is, "UTF-8");
			BufferedReader fr = new BufferedReader(ff);
			String line = "";
			int pos=-1;
			while ((line = fr.readLine()) != null) {
				line=line.trim();
				if((pos=line.indexOf(COMMENT))!=-1){
					line=line.substring(0,pos);
				}
				if (!line.equals("")) {
					dealor.dealorLine(line.trim());
				}
			}
			ff.close();
			fr.close();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {

		}
	}
	}
